using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class T : Sailfish.ItemTask
{
    float time = 5;

    public override void Update()
    {
        base.Update();

        if(time>0)
        {
            time -= Time.deltaTime;
        }
        else
        {
            isGaming = false;
        }
    }

}

public class INput : MonoBehaviour
{
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
           StartCoroutine(Wait());
           // Test();
        }
    }

    async void Test()
    {
        Debug.Log("kaishi begin");
        await new T();
        Debug.Log("kaishi eng");
        Debug.Log("2 begin");
        await this.UpdateTime(3.0f).OnFinish(() => { Debug.Log("wancheng"); }); 
        Debug.Log("2 end");
    }

    IEnumerator Wait()
    {
      var tk=  new T();
        Debug.Log("kaishi begin");
        yield return tk;
        Debug.Log("kaishi eng");
        Debug.Log("2 begin");
        yield return this.UpdateTime(3.0f).OnFinish(() => { Debug.Log("wancheng"); });
        Debug.Log("2 end");
     
    }
}
